@@ -1,5 +1,10 @@
This file documents the revision history for Perl extension Gitalist.
+0.002009 2011-03-06
+ - Document the available configuration options.
+ - Provide switch in config for forcing recursive repo searching.
+ - Assume UTF8 encoded blobs.
+
0.002008 2011-02-26
- Add the ability to provide a whitelist of repos.
- Add support for export-ok config option.
@@ -24,7 +24,7 @@ no_index:
provides:
Gitalist:
file: lib/Gitalist.pm
- version: 0.002008
+ version: 0.002009
Gitalist::ActionRole::FilenameArgs:
file: lib/Gitalist/ActionRole/FilenameArgs.pm
Gitalist::ContentMangler::Resolver:
@@ -149,6 +149,7 @@ requires:
Sys::Hostname: 0
Template: 2.22
Template::Plugin::Cycle: 0
+ Template::Plugin::UTF8Decode: 0
Template::Provider::Encoding: 0
Try::Tiny: 0
aliased: 0
@@ -157,4 +158,4 @@ resources:
bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Gitalist
license: http://opensource.org/licenses/gpl-2.0.php
repository: git://git.shadowcat.co.uk/catagits/Gitalist.git
-version: 0.002008
+version: 0.002009
@@ -72,6 +72,7 @@ requires 'Try::Tiny';
requires 'Template' => '2.22';
requires 'Template::Provider::Encoding';
requires 'Template::Plugin::Cycle';
+requires 'Template::Plugin::UTF8Decode';
requires 'Config::General';
@@ -137,6 +137,39 @@ RUNNING
http://example.gitalist.com
+CONFIGURATION
+ The Gitalist config is loaded with Catalyst::Plugin::ConfigLoader and
+ the available config options are:
+
+ Model::CollectionOfRepos
+ git Path to the "git" binary.
+
+ repo_dir
+ A directory containing the directories to show.
+
+ If no repositories are found in this directory then Gitalist will
+ search recursively in that directory for repositories.
+
+ search_recursively
+ A boolean indicating whether to always search recursively for
+ repositories within "repo_dir".
+
+ whitelist
+ Path a file containing a list of repositories that can be shown.
+ Each line in the file will represent the name of a repo to show e.g
+
+ Gitalist
+ some-bare-repo.git
+
+ This is compatible with "gitweb"'s "projects.list".
+
+ export_ok
+ If provided every must contain a file of the same name to be
+ visible. This is similar to "gitweb"'s functionality.
+
+ paging
+ log The number of commits to show in the
+
FASTCGI
Running Gitalist in FastCGI mode requires a webserver with FastCGI
support (such as apache with <mod_fcgi> or <mod_fcgid>). Below is a
@@ -8,22 +8,12 @@ name Gitalist
sitename "A Gitalist"
-# $feature{'blame'}{'default'} = [1];
-<feature>
- <blame>
- default = 1
- </blame>
-</feature>
-
-# fs traversing limit for getting project list
-# the number is relative to the projectroot
-project_maxdepth 2007
-
<paging>
log = 50
summary = 17
</paging>
+# Support gitweb patches action.
<patches>
max = 16
</patches>
@@ -62,7 +62,7 @@ after blame => sub {
my($self, $c) = @_;
my $repository = $c->stash->{Repository};
- # WTF?
+
my $blame = $c->stash->{Commit}->blame($c->stash->{filename}, $c->stash->{Commit}->sha1);
$c->stash(
blame => $blame,
@@ -94,7 +94,7 @@ after history => sub {
my %logargs = (
sha1 => $c->stash->{Commit}->sha1,
- count => 25, #Gitalist->config->{paging}{log} || 25,
+ count => Gitalist->config->{paging}{log} || 25,
($filename ? (file => $filename) : ())
);
@@ -31,6 +31,7 @@ sub raw : Chained('find') Does('FilenameArgs') Args() {
);
}
+ utf8::decode($c->stash->{blob});
$c->response->body(delete $c->stash->{blob});
}
@@ -48,7 +48,7 @@ sub base : Chained('/root') PathPart('') CaptureArgs(0) {
abridged_description => sub {
join(' ', grep { defined } (split / /, shift)[0..10]);
},
- uri_for_gravatar => sub { # FIXME - Cache these?
+ uri_for_gravatar => sub {
my $email = shift;
my $size = shift;
my $uri = 'http://www.gravatar.com/avatar/' . md5_hex($email);
@@ -50,6 +50,13 @@ has repos => (
coerce => 1,
);
+
+has search_recursively => (
+ is => 'ro',
+ isa => 'Bool',
+ default => 0,
+);
+
has export_ok => (
is => 'ro',
isa => 'Str',
@@ -60,7 +67,6 @@ has whitelist => (
isa => 'Str',
);
-
sub _build_repo_dir {
my $self = shift;
$ENV{GITALIST_REPO_DIR} ?
@@ -86,11 +92,10 @@ sub build_per_context_instance {
$class = 'Gitalist::Git::CollectionOfRepositories::FromDirectory::WhiteList';
$args{repo_dir} = $self->repo_dir;
$args{whitelist} = $self->whitelist;
- } elsif ($self->_repos_count) {
+ } elsif ($self->_repos_count && !$self->search_recursively) {
$class = 'Gitalist::Git::CollectionOfRepositories::FromListOfDirectories';
$args{repos} = $self->repos;
- }
- else {
+ } else {
$class = 'Gitalist::Git::CollectionOfRepositories::FromDirectoryRecursive';
$args{repo_dir} = $self->repo_dir;
}
@@ -14,7 +14,7 @@ use Catalyst qw/
SubRequest
/;
-our $VERSION = '0.002008';
+our $VERSION = '0.002009';
$VERSION = eval $VERSION;
__PACKAGE__->config(
@@ -206,6 +206,58 @@ This example can be seen live here:
http://example.gitalist.com
+=head1 CONFIGURATION
+
+The Gitalist config is loaded with L<Catalyst::Plugin::ConfigLoader>
+and the available config options are:
+
+=head2 Model::CollectionOfRepos
+
+=over
+
+=item git
+
+Path to the C<git> binary.
+
+=item repo_dir
+
+A directory containing the directories to show.
+
+If no repositories are found in this directory then Gitalist will
+search recursively in that directory for repositories.
+
+=item search_recursively
+
+A boolean indicating whether to always search recursively for
+repositories within C<repo_dir>.
+
+=item whitelist
+
+Path a file containing a list of repositories that can be shown. Each
+line in the file will represent the name of a repo to show e.g
+
+ Gitalist
+ some-bare-repo.git
+
+This is compatible with C<gitweb>'s C<projects.list>.
+
+=item export_ok
+
+If provided every must contain a file of the same name to be
+visible. This is similar to C<gitweb>'s functionality.
+
+=back
+
+=head2 paging
+
+=over
+
+=item log
+
+The number of commits to show in the
+
+=back
+
=head2 FASTCGI
Running Gitalist in FastCGI mode requires a webserver with FastCGI
@@ -250,7 +302,6 @@ Also, note that Apache will refuse C<%2F> in Gitalist URLs
unless configured otherwise. Make sure C<AllowEncodedSlashes On>
is in your F<httpd.conf> file in order for this to run smoothly.
-
=head1 CONTRIBUTING
Patches are welcome, please feel free to fork on github and send pull requests, send patches
@@ -4,5 +4,6 @@
<div class='blob'>This is a binary file which won't render natively on the web, but you can get it here all the same: <a href="[% c.uri_for_action('/ref/raw', c.req.captures, filename) %]" title="[% filename %]">[% filename %]</a></div>
[%- ELSE -%]
[%- INCLUDE inc/syntax_highlight_css.tt2 -%]
-<pre class='blob'>[% IF mangled; blob; ELSE; blob | html; END; %]</pre>
+[%- USE UTF8Decode -%]
+<pre class='blob'>[% IF mangled; blob; ELSE; blob | utf8_decode | html; END; %]</pre>
[%- END -%]
@@ -99,6 +99,18 @@ throws_ok { Gitalist::Model::CollectionOfRepos->COMPONENT($ctx_gen->(), { repos
}
{
+ my $i = test_with_config({ repo_dir => "$FindBin::Bin/lib"});
+ is scalar($i->repositories->flatten), 5, 'Found 5 repos recursively';
+ isa_ok $i, 'Gitalist::Git::CollectionOfRepositories::FromDirectoryRecursive';
+}
+
+{
+ my $i = test_with_config({ repo_dir => "$FindBin::Bin/lib/repositories", search_recursively => 1 });
+ is scalar($i->repositories->flatten), 5, 'Found 5 repos recursively using config';
+ isa_ok $i, 'Gitalist::Git::CollectionOfRepositories::FromDirectoryRecursive';
+}
+
+{
my $i = test_with_config({ repos => [
"$FindBin::Bin/lib/repositories/bare.git",
"$FindBin::Bin/lib/repositories/repo1",